import request from "@/utils/request"

// ts接口
import type {
  TrademarkListDataModel,
  TrademarkMode,
} from "@/api/product/model/Trademark"
// 定义请求地址的枚举
enum Api {
  GetTrademarkList = "/admin/product/baseTrademark",
  GetAllTrademarkList = "/admin/product/baseTrademark/getTrademarkList",
  SaveTrademark = "/admin/product/baseTrademark/save",
  DeleteTrademark = "/admin/product/baseTrademark/remove",
  UpdateTrademark = "/admin/product/baseTrademark/update",
}
//获取所有品牌列表
export const reqGetAllTrademarkList = () => {
  return request.get<any, any>(Api.GetAllTrademarkList)
}

// 获取品牌分页列表
export const reqGetTrademarkData = (page: number, limit: number) => {
  return request.get<any, TrademarkListDataModel>(
    `${Api.GetTrademarkList}/${page}/${limit}`
  )
}

// 添加
/* export const reqSaveTrademark = (tnName: string, logoUrl: string) => {
  return request.post<any, null>(Api.SaveTrademark, {
    tnName,
    logoUrl,
  })
} */
export const reqSaveTrademark = (form: TrademarkMode) => {
  return request.post<any, null>(Api.SaveTrademark, form)
}
// 修改
export const reqUpdateTrademark = (form: TrademarkMode) => {
  return request.put<any, null>(Api.UpdateTrademark, form)
}

// 删除
export const reqDeleteTrademark = (id: number) => {
  return request.delete<any, null>(Api.DeleteTrademark + `/${id}`)
}
